<template>
  <div class="child2">
    <h2>我是Child2</h2>
    <h4>我的车：{{car}}</h4>
    <h4>我的房：{{house}}</h4>
    <button @click="handleClick">把汽车给哥哥（Child1）</button>
    <Grandson/>
  </div>
</template>

<script>
  import Grandson from './Grandson.vue'
  export default {
    name:'Child2',
    components:{Grandson},
    data() {
      return {
        car:'迈巴赫',
        house:'汤臣一品'
      }
    },
    methods: {
      handleClick(){
        this.$bus.$emit('get-car',this.car)
      }
    },
  }
</script>

<style scoped>
  .child2 {
    background-color: orange;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 0 10px;
    margin-top: 10px;
  }
</style>